
public ArrCode
public ArrXCode
public ArrRsn
public ArrXRsn

Sub window_onload



'****************************************************
' Selected Indexes for Windows Onload Event			*
' Set the Selected Indexes for Validation Return	*
'													*
'****************************************************

If frmFormAD.DirRsnIndex.value <> "" then
	frmFormAD.lstRFD.selectedIndex = frmFormAD.DirRsnIndex.value
else
	frmFormAD.lstRFD.selectedIndex = 0
end If
	
If frmFormAD.CalMethod.value = "" then
	frmFormAD.CalMethod.value = "01"
end If

'****************************************************************************
'The "GET" Value shows that it is the first Time that the Form is loaded	*
'The Fund Type list Box are generated										*
'The Directive Reason's default value are set								*
'****************************************************************************

iF frmFormAD.new.value="GET" then
	frmFormAD.lstRFD.selectedIndex = 2
	clearall(frmFormAD)
	
	If frmFormAD.fund.value = "no" then
		'frmFormAD.chkNewFund.focus
		ClearFund(frmFormAD)
	end If
	
end If

End Sub   'END OF WINDOW ON LOAD EVENT

'****************************************************
' On Submit Button set the Selected Index Varaibles	*
'****************************************************

Sub SubmitDirective_onclick
	frmFormAD.DirRsnIndex.value = frmFormAD.lstRFD.selectedIndex
End Sub


sub txtADMonth_onfocus 
	
end Sub

sub txtADDay_onfocus
	
end Sub

sub txtADYear_onfocus
	
end Sub

sub txtCDMonth_onfocus
	
end Sub

 sub txtCDDay_onfocus
	
end Sub

sub txtCDYear_onfocus
	
END Sub

sub txtGLS_onfocus
	
end Sub
	

Sub txtFJDYear_onchange
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		Call KeyTaxMessageBox("The year you have entered, is not valid", "Input Error", "Exclamation")
		'MSGBOX "Invalid YEAR"
		frmFormAD.focusset.value="FJDYearSet"
		FrmFormAD.FJD.value = ""
	Else
		if LEN(frmFormAD.txtFJDYear.value) <> 4 OR frmFormAD.txtFJDYear.value = "0000" THEN
			Call KeyTaxMessageBox("The year you have entered, is not valid", "Input Error", "Exclamation")
			'MSGBOX "Invalid YEAR"
			frmFormAD.focusset.value="FJDYearSet"
			FrmFormAD.FJD.value = ""
		else
			iF IsNumeric(frmFormAD.txtFJDYear.value) = False then
				Call KeyTaxMessageBox("The year you have entered, is not valid", "Input Error", "Exclamation")
				'MSGBOX "Invalid YEAR"
				frmFormAD.focusset.value="FJDYearSet"
				FrmFormAD.FJD.value = ""
			else
				If len(frmFormAD.txtFJDDay.value) = 2 and len(frmFormAD.txtFJDMonth.value) =2  then
					call txtFJDDay_Onchange()
				end If
			end If
		end if	
	END iF
End Sub

Sub txtFJDMonth_onchange()
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		Call KeyTaxMessageBox("The month you have entered, is not valid", "Input Error", "Exclamation")
		'MSGBOX "Invalid MONTH"
		FrmFormAD.focusset.value="FJDMonthSet"
		FrmFormAD.FJD.value = ""
	Else
		if LEN(FrmFormAD.txtFJDMonth.value) <> 2 OR FrmFormAD.txtFJDMonth.value >12 THEN
			Call KeyTaxMessageBox("The month you have entered, is not valid", "Input Error", "Exclamation")
			'MSGBOX "Invalid MONTH"
			FrmFormAD.focusset.value="FJDMonthSet"
			FrmFormAD.FJD.value = ""
		ELSE 
			iF IsNumeric(FrmFormAD.txtFJDMonth.value) = False then
				Call KeyTaxMessageBox("The year you have entered, is not valid", "Input Error", "Exclamation")
				'MSGBOX "Invalid YEAR"
				FrmFormAD.focusset.value="FJDMonthSet"
				FrmFormAD.FJD.value = ""
			end If
			If len(frmFormAD.txtFJDDay.value) = 2 and len(frmFormAD.txtFJDYear.value) =4  then
				call txtFJDDay_onchange
			end If
		END iF
	End If
End Sub

Sub txtFJDDay_onchange()
	if LEN(frmFormAD.txtFJDDay.value) <> 2 THEN
		Call KeyTaxMessageBox("The day you have entered, is not valid", "Input Error", "Exclamation")
		'MSGBOX "Invalid DAY"
		frmFormAD.focusset.value="FJDDaySet"
		FrmFormAD.FJD.value = ""
	Else
		THEMONTH = frmFormAD.txtFJDMonth.value
		iF LEN(THEMONTH) = 2 Then
			strMM = GetMonth(THEMONTH)
			If strMM = "NotValid" then
				Call KeyTaxMessageBox("The date you have entered, is not valid", "Input Error", "Exclamation")	
				'Msgbox "Date Invalid."
				frmFormAD.focusset.value="FJDDaySet"
				FrmFormAD.FJD.value = ""
			Else
				if len(frmFormAD.txtFJDDay.value)=2 and len(frmFormAD.txtFJDYear.value)=4 then
					NewDate = frmFormAD.txtFJDDay.value & " " &  strMM & " " & frmFormAD.txtFJDYear.value		
					If ISDATE(Newdate)=FALSE THEN
						Call KeyTaxMessageBox("The date you have entered, is not valid", "Input Error", "Exclamation")	
						'msgbox "Date Invalid"
						frmFormAD.focusset.value="FJDDaySet"
						FrmFormAD.FJD.value = ""
					Else
						frmFormAD.FJD.value = NewDate
					End If
				else
					Call KeyTaxMessageBox("The month you have entered, is not valid", "Input Error", "Exclamation")
					'msgbox "Month Invalid"
					frmFormAD.focusset.value="FJDDaySet"
					FrmFormAD.FJD.value = ""
				end If
			END iF
		Else
			Call KeyTaxMessageBox("The month you have entered, is not valid", "Input Error", "Exclamation")
			'msgbox "Month Invalid"
			frmFormAD.focusset.value="FJDDaySet"
			FrmFormAD.FJD.value = ""
		end If
	end If
End Sub

Sub txtFRDYear_onchange
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		Call KeyTaxMessageBox("The year you have entered, is not valid", "Input Error", "Exclamation")
		'MSGBOX "Invalid YEAR"
		frmFormAD.focusset.value="FRDYearSet"
		FrmFormAD.FRD.value = ""
	Else
		if LEN(frmFormAD.txtFRDYear.value) <> 4 OR frmFormAD.txtFRDYear.value = "0000" THEN
			Call KeyTaxMessageBox("The year you have entered, is not valid", "Input Error", "Exclamation")
			'MSGBOX "Invalid YEAR"
			frmFormAD.focusset.value="FRDYearSet"
			FrmFormAD.FRD.value = ""
		else
			iF IsNumeric(frmFormAD.txtFRDYear.value) = False then
				Call KeyTaxMessageBox("The year you have entered, is not valid", "Input Error", "Exclamation")
				'MSGBOX "Invalid YEAR"
				frmFormAD.focusset.value="FRDYearSet"
				FrmFormAD.FRD.value = ""
			else
				If len(frmFormAD.txtFRDDay.value) = 2 and len(frmFormAD.txtFRDMonth.value) =2  then
					call txtFRDDay_Onchange()
				end If
			end If
		end if	
	END iF
End Sub



sub txtFRDMonth_onfocus()
	
end Sub

Sub txtFRDMonth_onchange()
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		Call KeyTaxMessageBox("The month you have entered, is not valid", "Input error", "Exclamation")
		'MSGBOX "Invalid MONTH"
		FrmFormAD.focusset.value="FRDMonthSet"
		FrmFormAD.FRD.value = ""
	Else
		if LEN(FrmFormAD.txtFRDMonth.value) <> 2 OR FrmFormAD.txtFRDMonth.value >12 THEN
			Call KeyTaxMessageBox("The month you have entered, is not valid", "Input error", "Exclamation")
			'MSGBOX "Invalid MONTH"
			FrmFormAD.focusset.value="FRDMonthSet"
			FrmFormAD.FRD.value = ""
		ELSE 
			iF IsNumeric(FrmFormAD.txtFRDMonth.value) = False then
				Call KeyTaxMessageBox("The month you have entered, is not valid", "Input error", "Exclamation")
				'MSGBOX "Invalid YEAR"
				FrmFormAD.focusset.value="FRDMonthSet"
				FrmFormAD.FRD.value = ""
			end If
			If len(frmFormAD.txtFRDDay.value) = 2 and len(frmFormAD.txtFRDYear.value) =4  then
				call txtFRDDay_onchange
			end If	
		END iF
	End If
End Sub

sub txtFRDDay_onfocus()
	
end Sub

sub txtFJDDay_onfocus()
	
end Sub


sub txtFRDYear_onfocus()
	
end Sub

sub txtFJDYear_onfocus()
	
end Sub


Sub txtFRDDay_onchange()
	if LEN(frmFormAD.txtFRDDay.value) <> 2 THEN
		Call KeyTaxMessageBox("The day you have entered, is not valid", "Input error", "Exclamation")
		'MSGBOX "Invalid DAYss"
	Else
		THEMONTH = frmFormAD.txtFRDMonth.value
		If len(THEMONTH) = 2 then
			strMM = GetMonth(THEMONTH)
			If strMM = "NotValid" then
				Call KeyTaxMessageBox("The date you have entered, is not valid", "Input error", "Exclamation")
				'Msgbox "Date Invalid."
			Else
				if len(frmFormAD.txtFRDDay.value)=2 and len(frmFormAD.txtFRDYear.value)=4 then
					NewDate = frmFormAD.txtFRDDay.value & " " &  strMM & " " & frmFormAD.txtFRDYear.value		
					If ISDATE(Newdate)=FALSE THEN
						Call KeyTaxMessageBox("The date you have entered, is not valid", "Input error", "Exclamation")
						'msgbox "Date Invalid"
					Else
						frmFormAD.FRD.value = NewDate
					End If
				else
					Call KeyTaxMessageBox("The month you have entered, is not valid", "Input error", "Exclamation")
					'msgbox "Month Invalid"
				end If
			END iF
		else
			Call KeyTaxMessageBox("The date you have entered, is not valid", "Input error", "Exclamation")
			'msgbox "Date Invalid"
		end If
	end If
End Sub

sub FRDYearClear(FormName)
	call numbersonly()
end Sub

sub FRDMonthClear(FormName)
	call numbersonly()
end Sub

sub FRDDayClear(FormName)
	call numbersonly()
end Sub

sub FJDYearClear(FormName)
	call numbersonly()
end Sub

sub FJDMonthClear(FormName)
	call numbersonly()
end Sub

sub FJDDayClear(FormName)
	call numbersonly()
end Sub

sub txtTPAS_onfocus
	
end Sub

sub txtCN_onfocus
	
end Sub


sub txtFundName_onfocus
	
end Sub

sub txtCP_onfocus
	
end Sub

sub txtTelCode_onfocus
	
end Sub

sub txtTelNumber_onfocus
	
end Sub

sub txtPost1_onfocus
	
end Sub

sub txtPost2_onfocus
	
end Sub

sub txtPost3_onfocus
	
end Sub

sub txtPost4_onfocus
	
end Sub

sub txtPostCode_onfocus
	
end Sub

sub ExcessPensionClear(FormName)
	call numbersonly()
end Sub

sub TotContPensionClear(FormName)
	call numbersonly()
end Sub

sub txtExcessPension_onfocus
	
end Sub

sub txtTotContPension_onfocus
	
end Sub

sub Year1Clear(FormName)
	call numbersonly()
end Sub

sub txtYear1_onfocus
	
end Sub


sub Year2Clear(FormName)
	call numbersonly()
end Sub

sub txtYear2_onfocus

end Sub

sub Year3Clear(FormName)
	call numbersonly()
end Sub

sub txtYear3_onfocus

end Sub

sub Year4Clear(FormName)
	call numbersonly()
end Sub

sub txtYear4_onfocus
	
end Sub

sub Year5Clear(FormName)
	call numbersonly()
end Sub

sub txtYear5_onfocus
	
end Sub

sub Income1Clear(FormName)
	call numbersonly()
end Sub

sub txtYear1_onchange
	
end Sub

sub txtYear2_onchange
	
end Sub

sub txtYear3_onchange
	
end Sub

sub txtYear4_onchange
	
end Sub

sub txtYear5_onchange
	
end Sub

sub txtIncome1_onfocus
	
end Sub

sub Income2Clear(FormName)
	call numbersonly()
end Sub

sub txtIncome2_onfocus
	
end Sub

sub Income3Clear(FormName)
	call numbersonly()
end Sub

sub txtIncome3_onfocus
	
end Sub

sub Income4Clear(FormName)
	call numbersonly()
end Sub

sub txtIncome4_onfocus
	
end Sub

sub Income5Clear(FormName)
	call numbersonly()
end Sub

sub txtIncome5_onfocus
	
end Sub

sub DeathIncomeClear(FormName)
	call numbersonly()
end Sub

sub txtDeathIncome_onfocus
	
end Sub


sub PAYERefNrClear(FormName)
	call nocommas()
end Sub

sub txtPAYERefNr_onfocus
	
end Sub

sub EmployerClear(FormName)
	call nocommas()
end Sub

sub txtEmployer_onfocus
	
end Sub

sub EmplCPClear(FormName)
	call nocommas()
end Sub

sub txtEmplCP_onfocus
	
end Sub

sub EmplTelCodeClear(FormName)
	call nocommas()
end Sub

sub txtEmplTelCode_onfocus
	
end Sub


sub EmpTelNumberClear(FormName)
	call nocommas()
end Sub

sub txtEmpTelNumber_onfocus
	
end Sub

sub EmpPost1Clear(FormName)
	call nocommas()
end Sub

sub txtEmpPost1_onfocus
	
end Sub

sub EmpPost2Clear(FormName)
	call nocommas()
end Sub

sub txtEmpPost2_onfocus
	
end Sub

sub EmpPost3Clear(FormName)
	call nocommas()
end Sub

sub txtEmpPost3_onfocus
	
end Sub

sub EmpPost4Clear(FormName)
	call nocommas()
end Sub

sub txtEmpPost4_onfocus
	
end Sub

sub EmpPostCodeClear(FormName)
	call nocommas()
end Sub


sub txtEmpPostCode_onfocus
	
end Sub

sub EmpHome1Clear(FormName)
	call nocommas()
end Sub

sub txtEmpHome1_onfocus
	
end Sub

sub EmpHome2Clear(FormName)
	call nocommas()
end Sub

sub txtEmpHome2_onfocus
	
end Sub

sub EmpHome3Clear(FormName)
	call nocommas()
end Sub

sub txtEmpHome3_onfocus
	
end Sub

sub EmpHome4Clear(FormName)
	call nocommas()
end Sub

sub txtEmpHome4_onfocus
	
end Sub

sub EmpHomeCodeClear(FormName)
	call nocommas()
end Sub

sub txtEmpHomeCode_onfocus
	
end Sub

sub CNClear()
	call nocommas()
end Sub

sub txtCN_onfocus
	
end Sub

sub EmpNumberClear()
	call nocommas()
end Sub


sub txtFJDMonth_onfocus
	
end Sub

sub txtCDMonth_onfocus
	call nocommas()
end Sub

sub periodFund_onclick
	If frmFormAD.periodFund.checked = true then
		frmFormAD.periodFund.VALUE="02"
		frmFormAD.CalMethod.value =frmFormAD.periodFund.VALUE 
	end If
end Sub

sub rulesFund_onclick
	If frmFormAD.RulesFund.checked = true then
		frmFormAD.rulesFund.VALUE="01"
		frmFormAD.CalMethod.value =frmFormAD.rulesFund.VALUE 
	end If
end Sub